import { SaledataListApi } from '@/services/database'
import {ref,onMounted,reactive} from 'vue'
import type {Ref} from 'vue'

//用户列表数据
export const SaledataList = (pageNum = 1,query?:{}): [Ref<DataModule.DataInfo[]>, Ref<number>, (page?: number,query?:object) => Promise<void>] => {
    const data = ref([])
    // const total = ref<UserModule.IUserList['total']>(0)
    const total = ref(0)
  
    const loadData=async (page=1,query : object ={})=>{
      let ret = await SaledataListApi(page,query)
     
      if(ret.code===0){
        data.value = ret.data
        total.value = ret.data.A[0].total
        
      }
      
    }
    // console.log(loadData);
    onMounted(()=>{
      loadData(pageNum,query)
      console.log();
    })
    return[data,total,loadData]
  }